package com.beiding.workordersystem.system.controller;

import com.beiding.workordersystem.common.standard.R;
import com.beiding.workordersystem.system.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @GetMapping("/myMenuTree")
    R myMenuTree() {
        return R.ok(menuService.getMyMenuTree());
    }
/*
    @PostMapping("/associateRole")
    @PreAuthorize("hasAuthority('menu_role_associate')")
    R associateRole(@RequestBody @Validated MenuAssociateRoleVo menuAssociateRoleVo) {
        menuService.associateRole(menuAssociateRoleVo.getMenuId(), menuAssociateRoleVo.getRoleIds());
        return R.ok();
    }

    //只能修改名称
    @PostMapping("/save")
    R save(@RequestBody @Validated MenuVo menuVo) {
        MenuItemEntity menuItemEntity = new MenuItemEntity();
        BeanUtils.copyProperties(menuVo, menuItemEntity);
        menuService.save(menuItemEntity);
        return R.ok();
    }*/


}
